<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
<title>Windows Interface Reference: Menu structure</title>
</head>

<body>

<h1>Menu </h1>

<p>The Menu structure contains functions and structures to create and operate on menus.</p>

<pre>structure Menu:
  sig
    type HMENU and HBITMAP and HWND and HINSTANCE
    type RECT =  { left: int, top: int, right: int, bottom: int }
	
    datatype MenuFlag =
        MF_BYCOMMAND | MF_BYPOSITION | MF_SEPARATOR | MF_ENABLED | MF_GRAYED |
        MF_DISABLED | MF_UNCHECKED | MF_CHECKED | MF_USECHECKBITMAPS | MF_STRING |
        MF_BITMAP | MF_OWNERDRAW | MF_POPUP | MF_MENUBARBREAK | MF_MENUBREAK |
        MF_UNHILITE | MF_HILITE | MF_DEFAULT | MF_SYSMENU | MF_HELP |
        MF_RIGHTJUSTIFY | MF_MOUSESELECT

    datatype MenuIdOrHandle = MenuHandle of HMENU | MenuId of int

    datatype MenuItemOptions =
          MFT_MENUBARBREAK
        | MFT_MENUBREAK
        | MFT_RADIOCHECK
        | MFT_RIGHTJUSTIFY
        | MFT_RIGHTORDER

    datatype MenuItemType =
          MFT_BITMAP of HBITMAP
        | MFT_OWNERDRAW of int
        | MFT_SEPARATOR
        | MFT_STRING of string

    datatype MenuState =
          MFS_CHECKED
        | MFS_DEFAULT
        | MFS_DISABLED
        | MFS_ENABLED
        | MFS_GRAYED
        | MFS_HILITE
        | MFS_UNCHECKED
        | MFS_UNHILITE

    type MenuItemInfo =
        {
            menuType: MenuItemType,
            menuOptions: MenuItemOptions list,
            state: MenuState list,
            wID: int,
            hSubMenu: HMENU option,
            hbmpChecked: HBITMAP option,
            hbmpUnchecked: HBITMAP option,
            itemData: int
        }

    val <a
name="AppendMenu">AppendMenu</a> : HMENU * MenuFlag list * MenuIdOrHandle * MenuItemType -&gt; unit
    val CheckMenuRadioItem : HMENU * int * int * int * MenuFlag -&gt; unit
    val <a
name="CreateMenu">CreateMenu</a> : unit -&gt; HMENU
    val CreatePopupMenu : unit -&gt; HMENU
    val DeleteMenu : HMENU * int * MenuFlag -&gt; unit
    val DestroyMenu : HMENU -&gt; unit
    val DrawMenuBar : HWND -&gt; unit
    val EnableMenuItem : HMENU * int * MenuFlag -&gt; MenuFlag list
    val GetMenu : HWND -&gt; HMENU

    datatype GMDIFlags = GMDI_GOINTOPOPUPS | GMDI_USEDISABLED
    val GetMenuDefaultItem : HMENU * bool * GMDIFlags list -&gt; int

    val GetMenuItemCount : HMENU -&gt; int
    val GetMenuItemID : HMENU -&gt; int
    val GetMenuItemInfo : HMENU * int * bool -&gt; MenuItemInfo
    val GetMenuItemRect : HWND * HMENU * int -&gt; RECT
    val GetMenuState : HMENU * int * MenuFlag -&gt; MenuFlag list * int
    val GetMenuString : HMENU * int * MenuFlag -&gt; string
    val GetSubMenu : HMENU * int -&gt; HMENU
    val GetSystemMenu : HWND * bool -&gt; HMENU
    val HiliteMenuItem : HWND * HMENU * int * MenuFlag list -&gt; unit
    val InsertMenu : HMENU * int * MenuFlag list * MenuIdOrHandle * MenuItemType -&gt; unit
    val IsMenu : HMENU -&gt; bool
    val LoadMenu : HINSTANCE * Resource.RESID -&gt; HMENU
    val ModifyMenu : HMENU * int * MenuFlag list * MenuIdOrHandle * MenuItemType -&gt; unit
    val RemoveMenu : HMENU * int * MenuFlag -&gt; unit
    val SetMenu : HWND * HMENU option -&gt; unit
    val SetMenuItemInfo : HMENU * int * bool * MenuItemInfo -&gt; unit
    val InsertMenuItem : HMENU * int * bool * MenuItemInfo -&gt; unit

    datatype TrackPopupMenuOptions =
        TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_LEFTALIGN | TPM_CENTERALIGN | TPM_RIGHTALIGN |
        TPM_TOPALIGN | TPM_VCENTERALIGN | TPM_BOTTOMALIGN | (*TPM_HORIZONTAL | TPM_VERTICAL |*)
        TPM_NONOTIFY | TPM_RETURNCMD
    val TrackPopupMenu : HMENU * TrackPopupMenuOptions list * int * int * HWND -&gt; int

    val SetMenuContextHelpId: HMENU * int -&gt; unit
    val GetMenuContextHelpId: HMENU -&gt; int
  end</pre>
</body>
</html>
